package edu.sctu.practice.class02.hujie.cgs.practice02.test04;

/**
 * Created by hj on 2015/10/20.
 */
public class Number {
    private int n1;
    private int n2;
    int num;
public Number( int n1,int n2){
    this.n1=n1;
    this.n2=n2;
}
    public int addition() {
        num = n1 + n2;
        return num;
    }

    public int subtration() {
        num = n1 - n2;
    return  num;
    }

    public int multiplication() {
        num = n1 * n2;
    return num;
    }

    public int division() {
        if (n2 != 0) {
            num = n1 / n2;
        } else {
            System.out.println("n2不能为0！");
        }
return num;
    }

    public static void main(String[] args) {
        Number number = new Number(32,8);
        System.out.println("n1+n2的和为：" + number.addition());
        System.out.println("n1-n2的结果为：" + number.subtration());
        System.out.println("n1*n2的结果为：" + number.multiplication());
        System.out.println("n1/n2的结果为：" + number.division());
        System.out.println(number);
    }
}
